import axios from 'axios';
import { AuthorityDto, AuthorityVo, Menu } from '@/types/modules/system'

const contentPath = '/system/authority'

export function create(authority: AuthorityDto) {
  return axios.post<boolean>(`${contentPath}`, authority)
}

export function update(authority: AuthorityDto) {
  return axios.put<boolean>(`${contentPath}`, authority)
}

export function deleteById(id: number) {
  return axios.delete<boolean>(`${contentPath}/${id}`)
}

export function findById(id: number) {
  return axios.get(`${contentPath}/${id}`)
}

export function treeMenu() {
  return axios.get<Menu[]>(`${contentPath}/menu`)
}

export function treeList() {
  return axios.get<AuthorityVo[]>(`${contentPath}/tree`)
}

export function listTree() {
    return axios.get(`${contentPath}/tree`)
}